package com.mtr.databoard.domain.screens;

import com.mtr.databoard.domain.Entity;

import java.util.List;
import java.util.UUID;

public class Screen extends Entity<UUID> implements  Cloneable{
    private String  name;
    private String description;
    private int width;
    private int height;
    private ScreenResource cover;


    public ScreenResource getCover() {
        return cover;
    }

    public void setCover(ScreenResource cover) {
        this.cover = cover;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * 如果是要自适应的话，子组件需要算一算才行，预留，
     */
    private boolean autoFit;

    private List<ScreenComponent> components;

    /**
     * 复制
     * @return
     * @throws CloneNotSupportedException
     */
    public Screen copy() throws CloneNotSupportedException {
        Screen screen=(Screen)this.clone();
        screen.setId(UUID.randomUUID());
        return screen;
    }

    /**
     *
     * @param width
     * @param height
     */
    public  void setSize(int width,int height)
    {
        this.width = width;
        this.height=height;
    }

    public Screen() {
    }

    public Screen(String name) {
        this.name = name;
        this.setId(UUID.randomUUID());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public boolean getAutoFit() {
        return autoFit;
    }

    public void setAutoFit(boolean autoFit) {
        this.autoFit = autoFit;
    }

    public List<ScreenComponent> getComponents() {
        return components;
    }

    public void setComponents(List<ScreenComponent> components) {
        this.components = components;
    }
}
